package com.android.sanitytest;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;

/**
 * Created by chalse.park on 2014-09-03.
 */
public class SanityTest extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button btn  = (Button) findViewById(R.id.btn_popup);
        btn.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                PopupWindow popup = new PopupWindow(v);
                LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                View view= inflater.inflate(R.layout.test_popup_window, null);
                popup.setContentView(view);
                popup.setWindowLayoutMode(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
                popup.setTouchable(true);
                popup.setFocusable(true);
                popup.setOutsideTouchable(true);
                popup.setBackgroundDrawable(new BitmapDrawable());
                popup.showAsDropDown(v);
            }
        });
    }
}
